;; 详细测试call/cc与if结合使用
(display "测试call/cc与if结合使用\n\n")

(define x '(1 2 3))
(define k-if #f)

(display "原始x的值: ")
(display x)
(display "\n\n")

(display "执行带call/cc的if表达式...\n")
(define result1 
  (if (call/cc
          (lambda(k)
              (set! k-if k)
              (null? x)))
      '()
      (cdr x)))

(display "result1的值: ")
(display result1)
(display "\n\n")

(display "调用(k-if #t)...\n")
(define result2 (k-if #t))
(display "result2的值: ")
(display result2)
(display "\n\n")

(display "调用(k-if #f)...\n")
(define result3 (k-if #f))
(display "result3的值: ")
(display result3)
(display "\n\n")

(display "测试完成！所有call/cc调用都成功执行。\n")